package com.huike.game.Activity;

import android.content.Intent;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.huike.game.R;
import com.huike.game.view.marqueeText;

import androidx.appcompat.app.AppCompatActivity;

public class GameActivity70 extends AppCompatActivity implements View.OnClickListener {

    private ImageView iv_left_image;
    private TextView tv_left_text;
    private TextView tv_content_title;
    private ImageView iv_rigth_image;
    private TextView tv_right_text;
    private ImageView iv_game70_animation;
    private AnimationDrawable background;
    private marqueeText tv_game70_paomadeng;
    private LinearLayout ll_game70_recharge;
    private LinearLayout ll_game70_balance;
    private LinearLayout ll_game70_recode;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_game70);
        initView();
        initAnim();

        ll_game70_recharge.setOnClickListener(this);
        ll_game70_balance.setOnClickListener(this);
        ll_game70_recode.setOnClickListener(this);
    }

    private void initAnim() {
        background = (AnimationDrawable) iv_game70_animation.getBackground();
        background.start();//开始动画
    }

    private void initView() {
        iv_left_image = (ImageView) findViewById(R.id.iv_left_image);
        tv_left_text = (TextView) findViewById(R.id.tv_left_text);
        tv_content_title = (TextView) findViewById(R.id.tv_content_title);
        iv_rigth_image = (ImageView) findViewById(R.id.iv_rigth_image);
        tv_right_text = (TextView) findViewById(R.id.tv_right_text);

        tv_content_title.setText("高速ETC");
        tv_left_text.setVisibility(View.GONE);
        tv_right_text.setVisibility(View.GONE);
        iv_left_image.setImageResource(R.drawable.tiao);
        iv_rigth_image.setVisibility(View.GONE);

        iv_game70_animation = (ImageView) findViewById(R.id.iv_game70_animation);
        tv_game70_paomadeng = (marqueeText) findViewById(R.id.tv_game70_paomadeng);
        ll_game70_recharge = (LinearLayout) findViewById(R.id.ll_game70_recharge);
        ll_game70_balance = (LinearLayout) findViewById(R.id.ll_game70_balance);
        ll_game70_recode = (LinearLayout) findViewById(R.id.ll_game70_recode);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        background.stop();//关闭动画
        background = null;//释放资源
    }

    @Override
    public void onClick(View v) {
        if(v == ll_game70_recharge){//跳转ETC充值界面
            startActivity(new Intent(GameActivity70.this,rechargeActivity70.class));
        }else if(v == ll_game70_balance){//跳转ETC余额界面
            startActivity(new Intent(GameActivity70.this,balanceActivity70.class));
        }else if(v == ll_game70_recode){//跳转余额记录界面
            startActivity(new Intent(GameActivity70.this,recodeActivity70.class));
        }
    }
}
